<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>斐波那契数列</title>
</head>
<body>
    <!-- ```javascript
    1 2 3 4 5 6 7   8  9
    1 1 2 3 5 8 13 21  34.......
    推导公式：fib(m) = fib(m-1) + fib(m-2)
``` -->
<script>
    function fib(n){
        if(n==1||n===2){
            return 1;
        }
        // 变量更新
        // var n1=n-1;
        // var n2=n-2;
        return fib(n-1)+fib(n-2);
    }
    console.log(fib(10));
    
</script>
    
</body>
</html>